%% xSpacingTest2

Nin     = 20;
Nt      = 100;
Nout    = 60;

Lin     = 3.5;
Lt      = 7;
Lout    = 12;

dxin     = Lin / Nin;
dxt      = (Lt-Lin) / Nt;
dxout    = (Lout-Lt) / Nout;

dimXp  = Nin+Nt+Nout;
dimDxp = Nin+Nt+Nout-1;

xip = zeros (dimXp,1);
dxp = zeros (dimDxp,1);

xip (1) = 0;

for i=2:Nin
    xip (i) = xip(i-1) + dxin;
end
for i=1:Nt
    xip (Nin+i) = xip(Nin+i-1) + dxt;
end
for i=1:Nout
    xip (Nin+Nt+i) = xip(Nin+Nt+i-1) + dxout;
end

%
% plot ([1:1:Nout+Nin+Nt] , xip,'-x');

for i=1:dimDxp
    dxp ( i ) = xip (i+1) - xip (i) ;
end

Nx = dimXp;

Ny = 21;
Ly = 2;
dye = Ly /(Ny+1);
dymin = 0.1 * Ly /(Ny+1);

dimYp = Ny;

yip = zeros (dimYp,1);

yip(1) = 0;

maxdy  = 0.1;
yip(2) = maxdy;

c      = 0.8; 

for i=3: floor(Ny/2)
    yip(i) = yip (i-1) + ( yip (i-1) - yip(i-2) ) * c^i;
end

yip = yip / yip (floor (Ny/2));

for i=floor(Ny/2)+1:Ny
    yip (i) = 1 + (i-floor(Ny/2)) * Ly / 2 / (Ny-floor(Ny/2)) ; 
end


yip2(1)=0;

for i=2:Ny
    auxp = i/Ny; 
    if (auxp<0.5) 
    yip2 (i) = -4 * auxp^2 + 4* auxp  ;
    else
        yip2 (i) = 1 - 4 * auxp^2 + 4* auxp;
    end
end

Xp = zeros (dimXp,dimYp);
Yp = zeros (dimXp,dimYp);


for i=1:dimXp
    for j=1:dimYp
        Xp (i,j) = xip(i);
        Yp (i,j) = yip(j);
    end
end

plot (Xp,Yp,'x')





